<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  function Pad(n){
    this.name = n
    this.game = function(){
      console.log(this.name + "玩游戏")
    }
  }
  function Phone(n){
    this.name = n
    this.game = function(){
      console.log(this.name + "玩游戏")
    }
    this.call = function(){
      console.log(this.name + "打电话")
    }
  }

  function test(o){
    o.game();
    o.call();
  }

  const p1 = new Pad("平板");
  const p2 = new Phone("手机");

  function 适配器(pad){
    pad.call = function(){
      console.log("这是一个平板，没有打电话功能");
    }
    return pad;
  }

  // test(p2);

  test( 适配器(p1) );
  
</script>
</html>